﻿using Caliburn.Micro;
using KouDai.WinPad.Helper;

namespace KouDai.WinPad.ViewModels
{
    public abstract class KouDaiScreen : Screen
    {
        private readonly INavigationService _navigationService;
        protected bool _loading = false;


        public virtual bool Loading
        {
            get { return _loading; }
            set
            {
                if (value != _loading)
                {
                    _loading = value;
                    this.NotifyOfPropertyChange(() => this.Loading);
                }
            }
        }

        protected KouDaiScreen()
        {

        }

        protected KouDaiScreen(INavigationService navigationService)
        {
            this._navigationService = navigationService;
        }

        public void GoBack()
        {
            if (FrameStackHelper.Instance.Num != 0)
            {
                FrameStackHelper.Instance.RmovePageFromStack();
            }
            else
            {
                _navigationService.GoBack();
            }
        }

        public bool CanGoBack
        {
            get
            {
                return _navigationService.CanGoBack;
            }
        }

        public abstract void LoadDesignData();
    }
}
